import json

from netmiko import ConnectHandler

huawei_router_AR5 = {
    'device_type': 'huawei_vrp',
    'host':   '192.168.12.12',
    'username': 'sshadmin',
    'password': 'Tontron@1169',
    'port' : 22,          # optional, defaults to 22
    'secret': '',     # optional, defaults to ''
}


with ConnectHandler(**huawei_router_AR5) as connect:
    # commands = ['security-policy', 'dis this']
    # output = connect.send_config_set(commands,exit_config_mode = True,terminator = r"return")
    # print(output)
    # commands = ['security-policy', 'rule name dmz2untrust','source-address 10.0.2.0 mask 255.255.255.0','dis this']
    commands = ['security-policy', 'dis zone']
    output = connect.send_config_set(commands, exit_config_mode=True, terminator=r"return")
    print(output)


# net_connect = ConnectHandler(**huawei_router_AR5)
# output = net_connect.send_command(f'dis ip ro')
# output = net_connect.send_command('display cu')
# 断开连接
# net_connect.disconnect()
# print(output)
